/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package de.kipcorn.App;

import de.kipcorn.networking.XmlInStream;
import de.kipcorn.networking.XmlOutStream;
import de.kipcorn.type.AcceptMessageType;
import de.kipcorn.type.LoginMessageType;
import de.kipcorn.type.LoginReplyMessageType;
import de.kipcorn.type.MazeCom;
import de.kipcorn.type.MazeComType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import javax.xml.bind.JAXBException;


/**
 *
 * @author lars.kloeser
 */
public class App {
    
    public static void main(String[] args) throws IOException, JAXBException, InterruptedException {
        int id;
        MazeCom loginMsg = new MazeCom();
        LoginMessageType loginMsgType = new LoginMessageType();
        loginMsgType.setName("Kipkorn");
        loginMsg.setMcType(MazeComType.LOGIN);
        loginMsg.setLoginMessage(loginMsgType);
        Socket serverSocket = new Socket("localhost",5123);
		
        OutputStream outStream = serverSocket.getOutputStream();
        InputStream inStream = serverSocket.getInputStream();
        
        XmlOutStream out = new XmlOutStream(outStream);
        XmlInStream in = new XmlInStream(inStream);
        out.write(loginMsg);
        MazeCom test = in.readMazeCom();
        id = test.getLoginReplyMessage().getNewID();
		      System.err.println(id);
        while(true){
            
        }
    }
}
